function C57_ERcorr(Data_Summary)
%% get all basic info to put into a summary table ready
animalNames = {'C57_5';'C57_6';'C57_7';'C57_8';'C57_10';'C57_11';'C57_14'};
genotype = {'WT';'WT';'WT';'WT';'WT';'WT';'WT'};

%% collect saline data
[C5_saline_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_5', 'saline');
[C6_saline_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_6', 'saline');
[C7_saline_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_7', 'saline');
[C8_saline_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_8', 'saline');
[C10_saline_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_10', 'saline');
[C11_saline_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_11', 'saline');
[C14_saline_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_14', 'saline');

% concatenate results
saline = cat(1, C5_saline_M, C6_saline_M, C7_saline_M, C8_saline_M, ...
    C10_saline_M, C11_saline_M, C14_saline_M);

%% collect altered_contexts data
[C5_altered_contexts_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_5', 'altered contexts');
[C6_altered_contexts_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_6', 'altered contexts');
[C7_altered_contexts_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_7', 'altered contexts');
[C8_altered_contexts_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_8', 'altered contexts');
[C10_altered_contexts_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_10', 'altered contexts');
[C11_altered_contexts_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_11', 'altered contexts');
[C14_altered_contexts_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_14', 'altered contexts');

% concatenate results
altered_contexts = cat(1, C5_altered_contexts_M, C6_altered_contexts_M, C7_altered_contexts_M, C8_altered_contexts_M, ...
    C10_altered_contexts_M, C11_altered_contexts_M, C14_altered_contexts_M);

%% collect R_CPP_1mg data
[C5_R_CPP_1mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_5', '(R)-CPP 1mg/kg');
[C6_R_CPP_1mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_6', '(R)-CPP 1mg/kg');
[C7_R_CPP_1mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_7', '(R)-CPP 1mg/kg');
[C8_R_CPP_1mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_8', '(R)-CPP 1mg/kg');
[C10_R_CPP_1mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_10', '(R)-CPP 1mg/kg');
[C11_R_CPP_1mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_11', '(R)-CPP 1mg/kg');
[C14_R_CPP_1mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_14', '(R)-CPP 1mg/kg');

% concatenate results
R_CPP_1mg = cat(1, C5_R_CPP_1mg_M, C6_R_CPP_1mg_M, C7_R_CPP_1mg_M, C8_R_CPP_1mg_M, ...
    C10_R_CPP_1mg_M, C11_R_CPP_1mg_M, C14_R_CPP_1mg_M);

%% collect R_CPP_3mg data
[C5_R_CPP_3mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_5', '(R)-CPP 3mg/kg');
[C6_R_CPP_3mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_6', '(R)-CPP 3mg/kg');
[C7_R_CPP_3mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_7', '(R)-CPP 3mg/kg');
[C8_R_CPP_3mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_8', '(R)-CPP 3mg/kg');
[C10_R_CPP_3mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_10', '(R)-CPP 3mg/kg');
[C11_R_CPP_3mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_11', '(R)-CPP 3mg/kg');
[C14_R_CPP_3mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_14', '(R)-CPP 3mg/kg');

% concatenate results
R_CPP_3mg = cat(1, C5_R_CPP_3mg_M, C6_R_CPP_3mg_M, C7_R_CPP_3mg_M, C8_R_CPP_3mg_M, ...
    C10_R_CPP_3mg_M, C11_R_CPP_3mg_M, C14_R_CPP_3mg_M);

%% collect R_CPP_10mg data
[C5_R_CPP_10mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_5', '(R)-CPP 10mg/kg');
[C6_R_CPP_10mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_6', '(R)-CPP 10mg/kg');
[C7_R_CPP_10mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_7', '(R)-CPP 10mg/kg');
[C8_R_CPP_10mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_8', '(R)-CPP 10mg/kg');
[C10_R_CPP_10mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_10', '(R)-CPP 10mg/kg');
[C11_R_CPP_10mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_11', '(R)-CPP 10mg/kg');
[C14_R_CPP_10mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_14', '(R)-CPP 10mg/kg');

% concatenate results
R_CPP_10mg = cat(1, C5_R_CPP_10mg_M, C6_R_CPP_10mg_M, C7_R_CPP_10mg_M, C8_R_CPP_10mg_M, ...
    C10_R_CPP_10mg_M, C11_R_CPP_10mg_M, C14_R_CPP_10mg_M);

%% collect pre_recall_R_CPP_10mg data
[C5_pre_recall_R_CPP_10mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_5', 'pre_recall_(R)-CPP 10mg/kg');
[C6_pre_recall_R_CPP_10mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_6', 'pre_recall_(R)-CPP 10mg/kg');
[C7_pre_recall_R_CPP_10mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_7', 'pre_recall_(R)-CPP 10mg/kg');
[C8_pre_recall_R_CPP_10mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_8', 'pre_recall_(R)-CPP 10mg/kg');
[C10_pre_recall_R_CPP_10mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_10', 'pre_recall_(R)-CPP 10mg/kg');
[C11_pre_recall_R_CPP_10mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_11', 'pre_recall_(R)-CPP 10mg/kg');
[C14_pre_recall_R_CPP_10mg_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_14', 'pre_recall_(R)-CPP 10mg/kg');

% concatenate results
pre_recall_R_CPP_10mg = cat(1, C5_pre_recall_R_CPP_10mg_M, C6_pre_recall_R_CPP_10mg_M, C7_pre_recall_R_CPP_10mg_M, C8_pre_recall_R_CPP_10mg_M, ...
    C10_pre_recall_R_CPP_10mg_M, C11_pre_recall_R_CPP_10mg_M, C14_pre_recall_R_CPP_10mg_M);

%% collect over_24h_recall data
[C5_over_24h_recall_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_5', '>24h same context');
[C6_over_24h_recall_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_6', '>24h same context');
[C7_over_24h_recall_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_7', '>24h same context');
[C8_over_24h_recall_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_8', '>24h same context');
[C10_over_24h_recall_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_10', '>24h same context');
[C11_over_24h_recall_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_11', '>24h same context');
[C14_over_24h_recall_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_14', '>24h same context');

% concatenate results
over_24h_recall = cat(1, C5_over_24h_recall_M, C6_over_24h_recall_M, C7_over_24h_recall_M, C8_over_24h_recall_M, ...
    C10_over_24h_recall_M, C11_over_24h_recall_M, C14_over_24h_recall_M);

%% collect midaz_005 data
[C5_midaz_005_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_5', 'midazolam 0.05mg/kg');
[C6_midaz_005_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_6', 'midazolam 0.05mg/kg');
[C7_midaz_005_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_7', 'midazolam 0.05mg/kg');
[C8_midaz_005_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_8', 'midazolam 0.05mg/kg');
[C10_midaz_005_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_10', 'midazolam 0.05mg/kg');
[C11_midaz_005_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_11', 'midazolam 0.05mg/kg');
[C14_midaz_005_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_14', 'midazolam 0.05mg/kg');

% concatenate results
midaz_005 = cat(1, C5_midaz_005_M, C6_midaz_005_M, C7_midaz_005_M, C8_midaz_005_M, ...
    C10_midaz_005_M, C11_midaz_005_M, C14_midaz_005_M);

%% collect midaz_025 data
[C5_midaz_025_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_5', 'midazolam 0.25mg/kg');
[C6_midaz_025_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_6', 'midazolam 0.25mg/kg');
[C7_midaz_025_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_7', 'midazolam 0.25mg/kg');
[C8_midaz_025_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_8', 'midazolam 0.25mg/kg');
[C10_midaz_025_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_10', 'midazolam 0.25mg/kg');
[C11_midaz_025_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_11', 'midazolam 0.25mg/kg');
[C14_midaz_025_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_14', 'midazolam 0.25mg/kg');

% concatenate results
midaz_025 = cat(1, C5_midaz_025_M, C6_midaz_025_M, C7_midaz_025_M, C8_midaz_025_M, ...
    C10_midaz_025_M, C11_midaz_025_M, C14_midaz_025_M);

%% collect midaz_125 data
[C5_midaz_125_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_5', 'midazolam 1.25mg/kg');
[C6_midaz_125_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_6', 'midazolam 1.25mg/kg');
[C7_midaz_125_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_7', 'midazolam 1.25mg/kg');
[C8_midaz_125_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_8', 'midazolam 1.25mg/kg');
[C10_midaz_125_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_10', 'midazolam 1.25mg/kg');
[C11_midaz_125_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_11', 'midazolam 1.25mg/kg');
[C14_midaz_125_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_14', 'midazolam 1.25mg/kg');

% concatenate results
midaz_125 = cat(1, C5_midaz_125_M, C6_midaz_125_M, C7_midaz_125_M, C8_midaz_125_M, ...
    C10_midaz_125_M, C11_midaz_125_M, C14_midaz_125_M);

%% collect midaz_25 data
[C5_midaz_25_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_5', 'midazolam 2.5mg/kg');
[C6_midaz_25_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_6', 'midazolam 2.5mg/kg');
[C7_midaz_25_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_7', 'midazolam 2.5mg/kg');
[C8_midaz_25_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_8', 'midazolam 2.5mg/kg');
[C10_midaz_25_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_10', 'midazolam 2.5mg/kg');
[C11_midaz_25_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_11', 'midazolam 2.5mg/kg');
[C14_midaz_25_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_14', 'midazolam 2.5mg/kg');

% concatenate results
midaz_25 = cat(1, C5_midaz_25_M, C6_midaz_25_M, C7_midaz_25_M, C8_midaz_25_M, ...
    C10_midaz_25_M, C11_midaz_25_M, C14_midaz_25_M);

%% collect prop_40 data
[C5_prop_40_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_5', 'propofol 40mg/kg');
[C6_prop_40_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_6', 'propofol 40mg/kg');
[C7_prop_40_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_7', 'propofol 40mg/kg');
[C8_prop_40_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_8', 'propofol 40mg/kg');
[C10_prop_40_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_10', 'propofol 40mg/kg');
[C11_prop_40_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_11', 'propofol 40mg/kg');
[C14_prop_40_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_14', 'propofol 40mg/kg');

% concatenate results
prop_40 = cat(1, C5_prop_40_M, C6_prop_40_M, C7_prop_40_M, C8_prop_40_M, ...
    C10_prop_40_M, C11_prop_40_M, C14_prop_40_M);

%% collect prop_80 data
[C5_prop_80_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_5', 'propofol 80mg/kg');
[C6_prop_80_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_6', 'propofol 80mg/kg');
[C7_prop_80_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_7', 'propofol 80mg/kg');
[C8_prop_80_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_8', 'propofol 80mg/kg');
[C10_prop_80_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_10', 'propofol 80mg/kg');
[C11_prop_80_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_11', 'propofol 80mg/kg');
[C14_prop_80_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_14', 'propofol 80mg/kg');

% concatenate results
prop_80 = cat(1, C5_prop_80_M, C6_prop_80_M, C7_prop_80_M, C8_prop_80_M, ...
    C10_prop_80_M, C11_prop_80_M, C14_prop_80_M);

%% collect prop_120 data
[C5_prop_120_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_5', 'propofol 120mg/kg');
[C6_prop_120_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_6', 'propofol 120mg/kg');
[C7_prop_120_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_7', 'propofol 120mg/kg');
[C8_prop_120_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_8', 'propofol 120mg/kg');
[C10_prop_120_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_10', 'propofol 120mg/kg');
[C11_prop_120_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_11', 'propofol 120mg/kg');
[C14_prop_120_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_14', 'propofol 120mg/kg');

% concatenate results
prop_120 = cat(1, C5_prop_120_M, C6_prop_120_M, C7_prop_120_M, C8_prop_120_M, ...
    C10_prop_120_M, C11_prop_120_M, C14_prop_120_M);

%% collect scop_2 data
[C5_scop_2_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_5', 'scopolamine 2mg/kg');
[C6_scop_2_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_6', 'scopolamine 2mg/kg');
[C7_scop_2_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_7', 'scopolamine 2mg/kg');
[C8_scop_2_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_8', 'scopolamine 2mg/kg');
[C10_scop_2_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_10', 'scopolamine 2mg/kg');
[C11_scop_2_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_11', 'scopolamine 2mg/kg');
[C14_scop_2_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_14', 'scopolamine 2mg/kg');

% concatenate results
scop_2 = cat(1, C5_scop_2_M, C6_scop_2_M, C7_scop_2_M, C8_scop_2_M, ...
    C10_scop_2_M, C11_scop_2_M, C14_scop_2_M);

%% collect scop_2_pre_recall data
[C5_scop_2_pre_recall_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_5', 'scopolamine 2mg/kg (pre-recall)');
[C6_scop_2_pre_recall_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_6', 'scopolamine 2mg/kg (pre-recall)');
[C7_scop_2_pre_recall_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_7', 'scopolamine 2mg/kg (pre-recall)');
[C8_scop_2_pre_recall_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_8', 'scopolamine 2mg/kg (pre-recall)');
[C10_scop_2_pre_recall_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_10', 'scopolamine 2mg/kg (pre-recall)');
[C11_scop_2_pre_recall_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_11', 'scopolamine 2mg/kg (pre-recall)');
[C14_scop_2_pre_recall_M] = ERcorr_Mean_Prism(Data_Summary, 'C57_14', 'scopolamine 2mg/kg (pre-recall)');

% concatenate results
scop_2_pre_recall = cat(1, C5_scop_2_pre_recall_M, C6_scop_2_pre_recall_M, C7_scop_2_pre_recall_M, C8_scop_2_pre_recall_M, ...
    C10_scop_2_pre_recall_M, C11_scop_2_pre_recall_M, C14_scop_2_pre_recall_M);

%% Now, make summary table

ERcorr_Summary_Table = table(animalNames, genotype, saline, altered_contexts, R_CPP_1mg, ...
    R_CPP_3mg, R_CPP_10mg, pre_recall_R_CPP_10mg, over_24h_recall, midaz_005, midaz_025, midaz_125, midaz_25, ...
    prop_40, prop_80, prop_120, scop_2, scop_2_pre_recall);

%% Export table

[ds, ~] = getdsap;
path = fullfile(ds.metadataPath, 'Prism excel data', 'ERcorr.xlsx');

if ~exist((fullfile(ds.metadataPath, 'Prism excel data')), 'dir')
    mkdir(fullfile(ds.metadataPath, 'Prism excel data'));
end
writetable(ERcorr_Summary_Table, path);

end